﻿<?php
$sql = "SELECT * FROM ".$tb_prefix."user WHERE user_id = '".$_SESSION['user_id']."'";
$query = $mysql->query($sql);
$row = mysql_fetch_array($query);
$email = $row['user_email'];
$pass	=	$row['user_password'];
if(isset($_POST['submit'])) {
$mail = $_POST['email'];
kiemtra_email($mail);
		if($_POST['pwd'] !== "") {
			$passwords = md5($_POST['pwd']);
		}
		if($_POST['pwd'] == "" || $_POST['pwd'] == "'" || $_POST['pwd'] == "'") {
			$passwords = $pass;
		}
	$mysql->query("UPDATE ".$tb_prefix."user SET user_email = '".$mail."' , user_password = '".$passwords."' WHERE user_id = '".$_SESSION['user_id']."'");
		echo "<script language='JavaScript'>{ window.parent.location='memcp.php?id=".$_SESSION['identifier']."&act=edit_pass_email' }</script>";
}
?>
<script src="js/check_form.js"></script>
<script src="../js/load.js"></script>
<div id="wait"></div>
<form action='memcp.php?id=<?=$_SESSION['identifier'];?>&act=edit_pass_email' method="post"  onsubmit="wait()">
<table width=750px>
	<tr><td align=center class=fr width=150px>Email</td><td class=fr_2><input type=text name="email" size=50 value="<?=$email;?>"></td></tr>
	<tr><td align=center class=fr >Mật khẩu mới</td><td class=fr_2><input type=password name="pwd" size=50></td></tr>

	
	<tr><td></td><td align=left><input type="submit" name="submit" value="Hoàn tất"><input type="reset" value="Reset"></td></tr>
</table>
</form>
